<%@page import="itsm.isperp.framework.core.context.ContextHolder"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	if ("1".equals(ContextHolder.getConfigByKey("systemLockscreen"))) {
%>

<script type="text/javascript" src="wro/lockscreen.js"></script>
<jsp:include page="lockscreen.jsp"></jsp:include>
<%
	}
%>


<section id="toolbar">
	<div class="container_12">
		<div class="left" style="display:none">
			<ul class="breadcrumb" id="main_nav">
			</ul>
		</div>
		<div class="qj">
			<ul>
			    <c:if test="${alarmSize>0 }">
			   
			    <c:forEach items="${alarmList }" var="list">
			       <li style="padding:0 4px;">
			       <img alt="点击进入" src="img/portal/快捷入口.png" height="16px" width="16px">
			       <a style="margin:0px;" href="${list.code }" target="_black" class="nui-txt-link">${list.name }</a>
				   </li>
			    </c:forEach>

			   <li class="oj">|</li>
			    
			    </c:if>
			   
			
				<li><a href="app/user/profileView" openType="iframe"
					onclick="javascript:isperp.showInWorkspace(this);return false;"
					navpath="/个人设置/" class="ir nui-txt-link mP"><span
						class="icon i14_admin-user"></span> <%=ContextHolder.getLoginUser().getFullname()%>
				</a>
				</li>
				<li class="oj">|</a>
				</li>
				<li><a href="javascript:loadUserMessages()"
					class="nui-txt-link"><span id="userMessagesCount">${messageTotal}</span>消息</a>
					<div id="userMessagesLi"></div></li>
				<%
					if ("1".equals(ContextHolder.getConfigByKey("wechatMpEnable"))) {
				%>
				<li><a href="javascript:loadWechatMessages()"
					class="nui-txt-link"><span id="userWechatMessagesCount">${wechatTotal}</span>微信消息</a>
				</li>
				<%
					}
				%>
				<%
					if ("1".equals(ContextHolder.getConfigByKey("systemLockscreen"))) {
				%>

				<li class="oj">|</a>
				</li>
				<li><a href="javascript:void(0);" id="btn-lock"
					class="nui-txt-link"><span>--:--</span>锁定屏幕</a>
				</li>

				<%
					}
				%><!-- <li class="oj">|</a></li>
				<li><a href="app/systemHelp/index/USER" class="nui-txt-link"
					target="_blank"><span class="icon i14_help"></span>帮助中心</a></li> -->
				<li class="oj">|</a></li>
				<li><a href="customer/help/user" target="_blank"
					class="nui-txt-link" style="color:red"><span
						class="icon i14_laptop"></span>事件登记</a>
				</li>
				<!---->
				<li class="oj" id="outli1">|</a></li>

				<li class="red"><a href="j_spring_security_logout"
					class="nui-txt-link">退出</a> <a id="bgsound"></a></li>

			</ul>
		</div>

	</div>
</section>
<script type="text/javascript">
	function loadUserMessages() {
		$("#userMessagesLi").html("载入中...");
		$.get("app/message/userMessages", function(data) {

			$("#userMessagesLi").html(data);

			isperp.showPopup("userMessagesLi");
		});
	}

	function loadWechatMessages() {
		isperp.openDialog({
			contentUrl : "wechat/chat/chatView"
		});
	}

	function getUserMessagesCount() {
		$.getJSON("app/message/userMessagesCount", function(data) {

			$("#userMessagesCount").html(data.messageTotal);
			$("#userWechatMessagesCount").html(data.wechatTotal);
			if (data.messageTotal > 0 || data.wechatTotal > 0) {
				//$("#bgsound").html("<embed id='sound' loop='1' autostart='true' hidden='true' src='img/main/attention.mp3'></embed>");

			} else {
				$("#bgsound").html("");
			}

		}).fail(function() {
			window.location.href = "main/login?error=session"
		});
	}
	getUserMessagesCount();
	window.setInterval(getUserMessagesCount, 60000);
</script>

